package com.example.sport;

import static java.lang.Integer.parseInt;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MusicActivity extends AppCompatActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_music);
    }

    public void onClick(View view){
        switch (view.getId()){
            case R.id.iv31:
                Intent intentReturnUp = new Intent(MusicActivity.this, TimeActivity3.class);
                startActivity(intentReturnUp);
                break;

            case R.id.iv5_2_2:
                Intent intent3=new  Intent();
                intent3.setClass(MusicActivity.this,TimeActivity4.class);
                startActivity(intent3);
                break;

            default:

                break;

        }
    }
}
//    private void init() {
//        intent2=new Intent(this,TimeActivity3.class);//创建意图对象
//        conn=new MyServiceConn();//创建服务连接对象
//        bindService(intent2,conn,BIND_AUTO_CREATE);//绑定服务
//    }
//    class MyServiceConn implements ServiceConnection {//用于实现连接服务
//        @Override
//        public void onServiceConnected(ComponentName name, IBinder service){
//            musicControl=(MusicService.MusicControl) service;
//        }
//        @Override
//        public void onServiceDisconnected(ComponentName name){
//
//        }
//    }
//    private void unbind(boolean isUnbind){
//        if(!isUnbind){//判断服务是否被解绑
//            unbindService(conn);//解绑服务
//        }
//    }
//    public void onClick(View v) {
////        MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.music_0);
//
//
//        switch (v.getId()){
//
//            case R.id.bn_user_1://播放按钮点击事件
//                if (!mediaPlayer.isPlaying()) {
//                    play.setBackgroundResource(R.drawable.ic_ab_start);
//                    String position=intent1.getStringExtra("position");
//                    int i=parseInt(position);
//                    musicControl.play(i);
//                    animator.start();
//                } else {//暂停
//                    play.setBackgroundResource(R.drawable.ic_ab_pause);
//                    mediaPlayer.pause();
//                    animator.pause();
//                }
//                break;
//
////            case R.id.bn_user_4://退出按钮点击事件
////                unbind(isUnbind);
////                isUnbind=true;
////                mediaPlayer.pause();
////                animator.pause();
////                finish();
////                break;
////
////        }
////    }
//    @Override
//    protected void onDestroy(){
//        super.onDestroy();
//        unbind(isUnbind);//解绑服务
//    }

}